﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using RRRSRoguelike.Managers;
using RRRSRoguelike.Entities;

namespace RRRSRoguelike.Helpers.Actions
{
    public static class ActionHelper
    {
        public static void Get(Point position)
        {
            if (DungeonManager.Instance.DungeonLevel.GetTile(position, Layers.Prop) is Sword &&
                !DungeonManager.Instance.CreatureManager.Player.Inventory.Any<Sword>())
            {
                
                Sword sword = DungeonManager.Instance.PropManager.GetBestSword(position);
                DungeonManager.Instance.CreatureManager.Player.Inventory.Add(sword);
                DungeonManager.Instance.PropManager.RemoveSword(sword);
            }
        }

        public static void Put(Point point)
        {
            if (DungeonManager.Instance.CreatureManager.Player.Inventory.Any<Sword>())
            {
                Sword s = DungeonManager.Instance.CreatureManager.Player.Inventory.OfType<Sword>().First();
                s.Position = DungeonManager.Instance.CreatureManager.Player.Position;
                DungeonManager.Instance.CreatureManager.Player.Inventory.Remove(s);
                DungeonManager.Instance.PropManager.AddSword(s);
            }
        }

    }
}
